package com.ad.pet.app.mall.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.models.remote.mall.Rating;

import java.util.List;

/**
 * Created by SEELE on 2019/5/14.
 */

public class GoodRatingAdapter extends BaseQuickAdapter<Rating, BaseViewHolder> {
    public GoodRatingAdapter(@Nullable List<Rating> data) {
        super(R.layout.item_good_record_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Rating item) {
        ImageView ivhead = helper.getView(R.id.iv_head);
        TextView tvDate = helper.getView(R.id.tv_date);
        TextView tvname = helper.getView(R.id.tv_name);
        TextView tvCountryName = helper.getView(R.id.tv_country_name);
        TextView tvDesc = helper.getView(R.id.tv_desc);
        View view = helper.getView(R.id.view_line);
        tvDate.setVisibility(View.GONE);
        GlideUtil.loadNoDefault(mContext, item.getCountry_image(), ivhead);
        tvDesc.setText(item.getContent());
        tvname.setText(item.getUser_name());
        tvCountryName.setText(item.getCountry());
        if (TextUtils.isEmpty(item.getContent())) {
            tvDesc.setVisibility(View.GONE);
            view.setVisibility(View.GONE);
        } else {
            tvDesc.setVisibility(View.VISIBLE);
            view.setVisibility(View.VISIBLE);
        }

    }
}
